package com.financing.wap.service.impl;


import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.financing.wap.dao.IFpPhoneClientDao;
import com.financing.wap.dto.FpPhoneClientDTO;
import com.financing.wap.service.IFpPhoneClientService;
import com.financing.wap.util.DTOdateSetUtil;
/**
 * fp_phone_client  
 * 用户手机端客户 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Repository("fpPhoneClientService")
public class FpPhoneClientServiceImpl implements IFpPhoneClientService{

	@Autowired
	private IFpPhoneClientDao fpPhoneClientDao;

	@Override
	public int insert(FpPhoneClientDTO fpPhoneClient) throws SQLException {
		return fpPhoneClientDao.insert(fpPhoneClient);
	}

	@Override
	public void update(FpPhoneClientDTO fpPhoneClient) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(fpPhoneClient);
		fpPhoneClientDao.update(fpPhoneClient);
	}

	@Override
	public void updateForce(FpPhoneClientDTO fpPhoneClient) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(fpPhoneClient);
		fpPhoneClientDao.updateForce(fpPhoneClient);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		fpPhoneClientDao.delete(id);
	}
	
	@Override
	public List<FpPhoneClientDTO> queryList(FpPhoneClientDTO fpPhoneClient) throws SQLException {
		return fpPhoneClientDao.queryList(fpPhoneClient);
	}

	@Override
	public int queryListCount(FpPhoneClientDTO fpPhoneClient) throws SQLException {
		return fpPhoneClientDao.queryListCount(fpPhoneClient);
	}

	@Override
	public FpPhoneClientDTO loadById(Integer id) throws SQLException {
		return fpPhoneClientDao.loadById(id);
	}
 	@Override
	public FpPhoneClientDTO queryListGetFirst(FpPhoneClientDTO fpPhoneClient)
			throws SQLException {
		 List<FpPhoneClientDTO> queryList = queryList(fpPhoneClient);
		 if(queryList==null||queryList.size()==0){
			 return new FpPhoneClientDTO();
		 }
		 return queryList.get(0);
	}

	@Override
	public Map<String, String> queryWechatAndFlagAdd(
			FpPhoneClientDTO fpPhoneClient) throws SQLException {
		return fpPhoneClientDao.queryWechatAndFlagAdd(fpPhoneClient);
	}
}
